package com.ruanyun.modular.ry.service;

import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruanyun.base.pojo.page.LayuiPageInfo;
import com.ruanyun.modular.ry.api.vo.req.AddressInsertReq;
import com.ruanyun.modular.ry.api.vo.req.AddressUpdateReq;
import com.ruanyun.modular.ry.entity.Address;
import com.ruanyun.modular.ry.model.params.AddressParam;
import com.ruanyun.modular.ry.model.result.AddressResult;

import java.util.List;

/**
 * <p>
 * 地址表 服务类
 * </p>
 *
 * @author conan
 * @since 2020-12-02
 */
public interface AddressService extends IService<Address> {

    /**
     * 新增
     *
     * @author conan
     * @Date 2020-12-02
     */
    void add(AddressParam param);

    /**
     * 删除
     *
     * @author conan
     * @Date 2020-12-02
     */
    void delete(AddressParam param);

    /**
     * 更新
     *
     * @author conan
     * @Date 2020-12-02
     */
    void update(AddressParam param);

    /**
     * 查询单条数据，Specification模式
     *
     * @author conan
     * @Date 2020-12-02
     */
    AddressResult findBySpec(AddressParam param);

    /**
     * 查询列表，Specification模式
     *
     * @author conan
     * @Date 2020-12-02
     */
    List<AddressResult> findListBySpec(AddressParam param);

    /**
     * 查询分页数据，Specification模式
     *
     * @author conan
     * @Date 2020-12-02
     */
     LayuiPageInfo findPageBySpec(AddressParam param);

    /**
     * 添加地址
     *
     * @param addressInsertReq
     * @return
     */
    ResponseData insertAddress(AddressInsertReq addressInsertReq, Long customerId);

    /**
     * 修改地址
     *
     * @param addressUpdateReq
     * @param customerId
     * @return
     */
    ResponseData updateAddress(AddressUpdateReq addressUpdateReq, Long customerId);

    /**
     * 列表查询带分页
     *
     * @param customerId
     * @return
     */
    ResponseData findPage(Integer current, Integer size, Long customerId);

    /**
     * 删除地址
     *
     * @param id
     * @return
     */
    ResponseData deleteAddressById(Long id);

    /**
     * 获取用户默认地址
     *
     * @param customerId
     * @return
     */
    ResponseData getDefaultAddressByCustomerId(Long customerId);
}
